package main

//正则
import (
	"fmt"
	"regexp"
)

var p = fmt.Println

func main() {
	//是否匹配到
	match, _ := regexp.MatchString("p([a-z]+)ch", "peach")
	p(match)
	r, _ := regexp.Compile("p([a-z]+)ch")
	p(r.MatchString("peach"))
	p(r.FindString("peach puuch"))
	t := r.FindStringIndex("peach punch")
	//fmt.Printf("%T\n")
	p(t)

	r = regexp.MustCompile("p([a-z]+)ch")
	fmt.Println(r.ReplaceAllString("p", "t"))
}
